package zhoufu.sz.sanxiao_check.net;

import android.content.Context;

import com.google.gson.Gson;

import javax.inject.Singleton;

import rx.Observable;
import rx.Subscription;
import zhoufu.sz.sanxiao_check.models.CheckItemModel;

import static zhoufu.sz.sanxiao_check.utils.DESUtil.EncryptAsToMap;

/**
 * 项目： SanXiao_Check
 * 时间： 2016/6/27 17:15
 * 人员： hyc
 * 功能：  中使用用来进行数据请求的类
 */
@Singleton
public class RefreshRepository extends RequestRepository {
    public RefreshRepository(Context Context, Gson gson) {
        super(Context, gson);
    }

    public Subscription GetLastExamine(String SID, RequestCallBack<CheckItemModel> back) {
        if (back == null) {
            throw new NullPointerException("RequestCallBack can't be empty");
        }
        String map = EncryptAsToMap(_mapBuilder.creatationHashMap().SID(SID).build());
        Observable<String> loginLatest = getStringObservable(map, "GetLastExamine");
        Subscription subscription = subChainWithCallBack(loginLatest, CheckItemModel.class, back);
        addSubscribe(subscription);
        return subscription;
    }
}
